package com.dyh.quickdemo.demos.ddyDemos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/*
@Author=Joey Wheeler
@Date=2020/10/13 15:31
*/
@Service
public class DdyUrlFacade {
    @Autowired
    DdyUrlBean ddyUrlBean;

    @Autowired
    DuoduoguojiAppkeyBean duoduoguojiAppkeyBean;

    public String url(String appKey){
        List<String> duoduoguojiKeys = duoduoguojiAppkeyBean.getAppkeys();
        if ((!CollectionUtils.isEmpty(duoduoguojiKeys))&&duoduoguojiKeys.contains(appKey))
            return ddyUrlBean.getDdgjUrl();
        return ddyUrlBean.getBaseUrl();
    }
}
